//122. 买卖股票的最佳时机 II(medium) : https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/description/
class Solution {
public:
    int maxProfit(vector<int>& prices) {
        int ret = 0;
        for (int i = 1; i < prices.size(); ++i) 
        {
            int curProfit = prices[i] - prices[i - 1];
            if (curProfit > 0)
                ret += curProfit;
        }
        return ret;
    }
};